﻿#pragma once

#include "../../MirControls/MirImageControl.h"
#include "../../MirControls/MirButton.h"
#include "../../MirControls/MirLabel.h"
#include "../../../Shared/Data/ClientData.h"
#include "../../../Shared/Enums.h"
#include <string>
#include <vector>
#include <cmath>
#include "../../../bankersrounding.h"
#include "../../../stringhelper.h"

using namespace Client::MirControls;
using namespace Client::MirGraphics;
using namespace Client::MirSounds;

namespace Client::MirScenes::Dialogs
{
    class BuffDialog final : public MirImageControl
    {
    private:
        MirButton *_expandCollapseButton;
        MirLabel *_buffCountLabel;
        std::vector<MirImageControl*> _buffList = std::vector<MirImageControl*>();
        bool _fadedOut = false, _fadedIn = false;
        int _buffCount = 0;
        long long _nextFadeTime = 0;

        static constexpr long long FadeDelay = 55;
        static constexpr float FadeRate = 0.2f;

    public:
        virtual ~BuffDialog()
        {
            delete _expandCollapseButton;
            delete _buffCountLabel;
        }

        BuffDialog();

        void CreateBuff(ClientBuff *buff);

        void RemoveBuff(int buffId);

        void Process();

    private:
        void UpdateWindow();




    public:
        std::string BuffString(ClientBuff *buff);

    private:
        std::string CombinedBuffText();

        int BuffImage(BuffType type);
    };
}

